﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 论文信息管理软件
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
            this.MydataSet.ReadXml(@"论文信息.xml");
            this.MydataGridView.DataSource = MydataSet.Tables["Paper"];
            this.MydataGridView.Columns[0].HeaderText = "序号";
            this.MydataGridView.Columns[1].HeaderText = "论文名";
            this.MydataGridView.Columns[2].HeaderText = "作者";
            this.MydataGridView.Columns[3].HeaderText = "关键词";
            this.MydataGridView.Columns[4].HeaderText = "摘要";
            this.MydataGridView.Columns[0].Width = 55;
            this.MydataGridView.Columns[1].Width = 120;
            this.MydataGridView.Columns[2].Width = 70;
            this.MydataGridView.Columns[3].Width = 140;
            this.MydataGridView.Columns[4].Width = 300;
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            AddForm AddForm = new AddForm(MydataSet);
            AddForm.Show();
        }

        private void btnRevised_Click(object sender, EventArgs e)
        {
            AddForm RevisedForm = new AddForm();
            RevisedForm.Text = "修改";
            RevisedForm.lbNumber.Text = Convert.ToString(MydataGridView.CurrentRow.Index + 1);
            RevisedForm.Show();
        }

        private void btnQuery_Click(object sender, EventArgs e)
        {
            QueryForm QueryForm = new QueryForm(MydataSet);
            QueryForm.Show();
        }

        private void btnRemove_Click(object sender, EventArgs e)
        {
            MydataGridView.Rows.Remove(MydataGridView.CurrentRow);
        }
     
     }           
        
}

